package com.unicom.office.matcher;

import com.unicom.office.node.OfficeNode;
import com.unicom.office.unit.OfficeUnit;
import com.unicom.office.unit.TextRangeUnit;

public class DataMatcher {
    private OfficeNode node;
    private OfficeUnit unit;

    public DataMatcher(OfficeNode node, OfficeUnit unit) {
        this.node = node;
        this.unit = unit;
    }

    public Object match(){
        if(unit instanceof TextRangeUnit){
            OfficeUnit next = unit;
            String str = "";
            while (next != null){
                str += ((TextRangeUnit)next).getText();
                next = next.getNext();
            }
            return str;
        }else{
            throw new RuntimeException("暂未处理");
        }
    }
}
